// hyb_yl/czhuanjiasubpages/pages/doctor_info/doctor_info.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },
  open_address:function(e){
    wx.openLocation({
      latitude: e.currentTarget.dataset.latitude*1,
      longitude: e.currentTarget.dataset.longitude*1,
      name:e.currentTarget.dataset.agentname,
      success:function(res){
        console.log(res)
      },
    })
  },
  gohospital:function(e){
    var hid = e.currentTarget.dataset.hid;
    wx.navigateTo({
      url: '/hyb_yl/mycenter/pages/mechanism/mechanism?hid=' + hid,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var zid = options.zid;
    var that = this;
    that.setData({
      zid:zid
    })
    that.getDocinfo();
  },
  getDocinfo(e) {
    var that = this
    var zid = that.data.zid
    app.util.request({
      'url': 'entry/wxapp/zhuanjia.getdocinfo',
      data: {
        zid: zid,
        openid: wx.getStorageSync('openid')
      },
      success: function (res) {
        wx.setNavigationBarTitle({
          title: res.data.z_name
        })
        
        that.setData({
          docopenid: res.data.openid,
          docinfo: res.data,
          z_name: res.data.z_name,
          randnum: res.data.randnum,
          privateNum: res.data.privateNum,
          authority: res.data.authority
        })
        if (res.data.video != '') {
          that.setData({
            video: true
          })
        }

      }
    })

  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})